@extends('web.layouts.app')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/ucenter.css')}}">
@endsection

@section('content')
    <div class="uc-wrap swrap mt20">
        <div class="uc-side L">
            <div class="uc-nav">
                <ul>
                    @include('web.user_center.menu')
                </ul>
            </div>
        </div>
   		<div class="uc-main uc-mainbg R">
		<div class="plr10 user-invest-project">
			<!--用户资产-->
			<div class="user-invest-bar clearfix">
				<dl class="invest-total">
					<dt>累计收益</dt>
					<dd><em>{{ ($hbMoney+$yslx)??0 }}</em>元</dd>
				</dl>
				<dl class="item-list">
					<dt>待收本金</dt>
					<dd>{{ $dsMoney??0 }}元</dd>		
				</dl>
				<dl class="item-list">
					<dt>待收利息</dt>
					<dd>{{ $dslx??0 }}元</dd>
				</dl>
				<dl class="item-list">
					<dt>已赚利息</dt>
					<dd>{{ $yslx??0 }}元</dd>
				</dl>
				<dl class="item-list">
					<dt>已奖励</dt>
					<dd>{{ $hbMoney??0 }}元</dd>
				</dl>
			</div>
			<!--列表-->
			<div class="user-item-list pt20">
				<h3 class="title">投资项目</h3>
				<div class="user-item-list-menu gray-bg">
					<a {{ $type == 0?'class=active':''}} href="{{ action('UserCenter\UserCenterController@investmentProjects',['type'=>0,'menu'=>12]) }}">所有投资</a><span>|</span>
					<a {{ $type == 1?'class=active':''}} href="{{ action('UserCenter\UserCenterController@investmentProjects',['type'=>1,'menu'=>12]) }}">投资中项目</a><span>|</span>
					<a {{ $type == 2?'class=active':''}} href="{{ action('UserCenter\UserCenterController@investmentProjects',['type'=>2,'menu'=>12]) }}">还款中项目</a><span>|</span>
					<a {{ $type == 3?'class=active':''}} href="{{ action('UserCenter\UserCenterController@investmentProjects',['type'=>3,'menu'=>12]) }}">已回款项目</a><span>|</span>
					<a {{ $type == 4?'class=active':''}} href="{{ action('UserCenter\UserCenterController@investmentProjects',['type'=>4,'menu'=>12]) }}">审核中项目</a>
				</div>
				<ul class="data-list near-invest-list">
					<li class="th">
						<div class="col-name">项目名称</div>
						<div class="col-money">投资金额</div>
						<div class="col-gains">预期收益(仅供参考)</div>
						<div class="col-invest-time">投资时间</div>
						<div class="col-expire-time">还款时间</div>
						<div class="col-status">进度情况</div>
						<div class="col-ht">合同资料</div>
					</li>
				@forelse($data as $d)
					<li>
						<div class="col-name name">
							<a href="/oneProjects/{{$d->id}}">{{ $d->projects_name }}</a>
						</div>
						<div class="col-money">{{ $d->invest_money }}</div>
						<div class="col-gains">
						@if($d->id<309 && ($d->expected_return == 0))
							请以老网站为准
						@else
							{{ $d->expected_return }}
						@endif
						</div>
						<div class="col-invest-time">{{ $d->invest_time }}</div>
						<div class="col-expire-time">{{ ($d->trade_finish_date??$d->trade_repayment_date)??'--' }}</div>
						<div class="col-status"> {{ \App\Admin\Eloquent\Code::findByCodeAndTypeId($d->status, 'project_status')['name'] }}</div>
						<div class="col-ht">
						@if(empty($d->projects_file))
							<span>待生成</span>
						@else
							<a class="blue" href="{{ action('UserCenter\UserCenterController@printTemplate',[$d->id]) }}" target="_bank">打印</a>
						@endif
						</div>
						<div id='print' style="display: none;">
							这里是合同正文
						</div>
					</li>
				@empty
					<li>最近没有投资的项目</li>
				@endforelse
				</ul>
				<div class="uc-page-box text-right">
					{!! $links !!}
				</div>
			</div>
		</div>
		
	</div>
</div>
@endsection

@section('scripts')
    <script src="{{ asset('resources/web/js/index.js') }}"></script>
    <script src="{{ asset('resources/web/plugins/jquery.migrate/jquery-migrate-1.1.0.min.js') }}"></script>
    <script src="{{ asset('resources/web/plugins/jquery.jqprint/jquery.jqprint-0.3.js') }}"></script>
    <script>
    	function print(){
    		$('#print').show();
    		$("#print").jqprint();
    		$('#print').hide();
    	}
    </script>
@endsection